home *** CD-ROM | disk | FTP | other *** search
/ Champak 52 / Volume 52 - JOGO DISK .iso / Games / dancing_princess.swf / scripts / __Packages / mx / managers / FocusManager.as < prev    next >
Text File  |  2007-09-26  |  22KB  |  687 lines

  1. class mx.managers.FocusManager extends mx.core.UIComponent
  2. {
  3.    static var symbolName = "FocusManager";
  4.    static var symbolOwner = mx.managers.FocusManager;
  5.    static var version = "2.0.0.360";
  6.    var className = "FocusManager";
  7.    var bNeedFocus = false;
  8.    var bDrawFocus = false;
  9.    var defaultPushButtonEnabled = true;
  10.    var activated = true;
  11.    static var initialized = false;
  12.    static var UIObjectExtensionsDependency = mx.core.ext.UIObjectExtensions;
  13.    function FocusManager()
  14.    {
  15.       super();
  16.    }
  17.    function get defaultPushButton()
  18.    {
  19.       return this.__defaultPushButton;
  20.    }
  21.    function set defaultPushButton(x)
  22.    {
  23.       if(x != this.__defaultPushButton)
  24.       {
  25.          this.__defaultPushButton.__set__emphasized(false);
  26.          this.__defaultPushButton = x;
  27.          this.defPushButton = x;
  28.          x.__set__emphasized(true);
  29.       }
  30.    }
  31.    function getMaxTabIndex(o)
  32.    {
  33.       var _loc3_ = 0;
  34.       var _loc6_ = undefined;
  35.       for(_loc6_ in o)
  36.       {
  37.          var _loc2_ = o[_loc6_];
  38.          if(_loc2_._parent == o)
  39.          {
  40.             if(_loc2_.tabIndex != undefined)
  41.             {
  42.                if(_loc2_.tabIndex > _loc3_)
  43.                {
  44.                   _loc3_ = _loc2_.tabIndex;
  45.                }
  46.             }
  47.             if(_loc2_.tabChildren == true)
  48.             {
  49.                var _loc4_ = this.getMaxTabIndex(_loc2_);
  50.                if(_loc4_ > _loc3_)
  51.                {
  52.                   _loc3_ = _loc4_;
  53.                }
  54.             }
  55.          }
  56.       }
  57.       return _loc3_;
  58.    }
  59.    function getNextTabIndex(Void)
  60.    {
  61.       return this.getMaxTabIndex(this.form) + 1;
  62.    }
  63.    function get nextTabIndex()
  64.    {
  65.       return this.getNextTabIndex();
  66.    }
  67.    function relocate(Void)
  68.    {
  69.       var _loc2_ = mx.managers.SystemManager.__get__screen();
  70.       this.move(_loc2_.x - 1,_loc2_.y - 1);
  71.    }
  72.    function init(Void)
  73.    {
  74.       super.init();
  75.       this.tabEnabled = false;
  76.       this._width = this._height = 1;
  77.       this._x = this._y = -1;
  78.       this._alpha = 0;
  79.       this._parent.focusManager = this;
  80.       this._parent.tabChildren = true;
  81.       this._parent.tabEnabled = false;
  82.       this.form = this._parent;
  83.       this._parent.addEventListener("hide",this);
  84.       this._parent.addEventListener("reveal",this);
  85.       mx.managers.SystemManager.init();
  86.       mx.managers.SystemManager.addFocusManager(this.form);
  87.       this.tabCapture.tabIndex = 0;
  88.       this.watch("enabled",this.enabledChanged);
  89.       Selection.addListener(this);
  90.    }
  91.    function enabledChanged(id, oldValue, newValue)
  92.    {
  93.       this._visible = newValue;
  94.       return newValue;
  95.    }
  96.    function activate(Void)
  97.    {
  98.       Key.addListener(this);
  99.       this.activated = this._visible = true;
  100.       if(this.lastFocus != undefined)
  101.       {
  102.          this.bNeedFocus = true;
  103.          if(!mx.managers.SystemManager.isMouseDown)
  104.          {
  105.             this.doLater(this,"restoreFocus");
  106.          }
  107.       }
  108.    }
  109.    function deactivate(Void)
  110.    {
  111.       Key.removeListener(this);
  112.       this.activated = this._visible = false;
  113.       var _loc2_ = this.getSelectionFocus();
  114.       var _loc3_ = this.getActualFocus(_loc2_);
  115.       if(this.isOurFocus(_loc3_))
  116.       {
  117.          this.lastSelFocus = _loc2_;
  118.          this.lastFocus = _loc3_;
  119.       }
  120.       this.cancelAllDoLaters();
  121.    }
  122.    function isOurFocus(o)
  123.    {
  124.       if(o.focusManager == this)
  125.       {
  126.          return true;
  127.       }
  128.       while(o != undefined)
  129.       {
  130.          if(o.focusManager != undefined)
  131.          {
  132.             return false;
  133.          }
  134.          if(o._parent == this._parent)
  135.          {
  136.             return true;
  137.          }
  138.          o = o._parent;
  139.       }
  140.       return false;
  141.    }
  142.    function onSetFocus(o, n)
  143.    {
  144.       if(n == null)
  145.       {
  146.          if(this.activated)
  147.          {
  148.             this.bNeedFocus = true;
  149.          }
  150.       }
  151.       else
  152.       {
  153.          var _loc2_ = this.getFocus();
  154.          if(this.isOurFocus(_loc2_))
  155.          {
  156.             this.bNeedFocus = false;
  157.             this.lastFocus = _loc2_;
  158.             this.lastSelFocus = n;
  159.          }
  160.       }
  161.    }
  162.    function restoreFocus(Void)
  163.    {
  164.       var _loc2_ = this.lastSelFocus.hscroll;
  165.       if(_loc2_ != undefined)
  166.       {
  167.          var _loc5_ = this.lastSelFocus.scroll;
  168.          var _loc4_ = this.lastSelFocus.background;
  169.       }
  170.       this.lastFocus.setFocus();
  171.       var _loc3_ = Selection;
  172.       Selection.setSelection(_loc3_.lastBeginIndex,_loc3_.lastEndIndex);
  173.       if(_loc2_ != undefined)
  174.       {
  175.          this.lastSelFocus.scroll = _loc5_;
  176.          this.lastSelFocus.hscroll = _loc2_;
  177.          this.lastSelFocus.background = _loc4_;
  178.       }
  179.    }
  180.    function onUnload(Void)
  181.    {
  182.       mx.managers.SystemManager.removeFocusManager(this.form);
  183.    }
  184.    function setFocus(o)
  185.    {
  186.       if(o == null)
  187.       {
  188.          Selection.setFocus(null);
  189.       }
  190.       else if(o.setFocus == undefined)
  191.       {
  192.          Selection.setFocus(o);
  193.       }
  194.       else
  195.       {
  196.          o.setFocus();
  197.       }
  198.    }
  199.    function getActualFocus(o)
  200.    {
  201.       var _loc1_ = o._parent;
  202.       while(_loc1_ != undefined)
  203.       {
  204.          if(_loc1_.focusTextField != undefined)
  205.          {
  206.             while(_loc1_.focusTextField != undefined)
  207.             {
  208.                o = _loc1_;
  209.                _loc1_ = _loc1_._parent;
  210.                if(_loc1_ == undefined)
  211.                {
  212.                   return undefined;
  213.                }
  214.                if(_loc1_.focusTextField == undefined)
  215.                {
  216.                   return o;
  217.                }
  218.             }
  219.          }
  220.          if(_loc1_.tabEnabled != true)
  221.          {
  222.             return o;
  223.          }
  224.          o = _loc1_;
  225.          _loc1_ = o._parent;
  226.       }
  227.       return undefined;
  228.    }
  229.    function getSelectionFocus()
  230.    {
  231.       var m = Selection.getFocus();
  232.       var o = eval(m);
  233.       return o;
  234.    }
  235.    function getFocus(Void)
  236.    {
  237.       var _loc2_ = this.getSelectionFocus();
  238.       return this.getActualFocus(_loc2_);
  239.    }
  240.    function walkTree(p, index, groupName, dir, lookup, firstChild)
  241.    {
  242.       var _loc5_ = true;
  243.       var _loc11_ = undefined;
  244.       for(_loc11_ in p)
  245.       {
  246.          var _loc2_ = p[_loc11_];
  247.          if(_loc2_._parent == p && _loc2_.enabled != false && _loc2_._visible != false && (_loc2_.tabEnabled == true || _loc2_.tabEnabled != false && (_loc2_.onPress != undefined || _loc2_.onRelease != undefined || _loc2_.onReleaseOutside != undefined || _loc2_.onDragOut != undefined || _loc2_.onDragOver != undefined || _loc2_.onRollOver != undefined || _loc2_.onRollOut != undefined || _loc2_ instanceof TextField)))
  248.          {
  249.             if(_loc2_._searchKey == this._searchKey)
  250.             {
  251.                continue;
  252.             }
  253.             _loc2_._searchKey = this._searchKey;
  254.             if(_loc2_ != this._lastTarget)
  255.             {
  256.                if((_loc2_.groupName != undefined || groupName != undefined) && _loc2_.groupName == groupName)
  257.                {
  258.                   continue;
  259.                }
  260.                if(_loc2_ instanceof TextField && _loc2_.selectable == false)
  261.                {
  262.                   continue;
  263.                }
  264.                if(_loc5_ || _loc2_.groupName != undefined && _loc2_.groupName == this._firstNode.groupName && _loc2_.selected == true)
  265.                {
  266.                   if(firstChild)
  267.                   {
  268.                      this._firstNode = _loc2_;
  269.                      firstChild = false;
  270.                   }
  271.                }
  272.                if(this._nextIsNext == true)
  273.                {
  274.                   if(_loc2_.groupName != undefined && _loc2_.groupName == this._nextNode.groupName && _loc2_.selected == true || this._nextNode == undefined && (_loc2_.groupName == undefined || _loc2_.groupName != undefined && _loc2_.groupName != groupName))
  275.                   {
  276.                      this._nextNode = _loc2_;
  277.                   }
  278.                }
  279.                if(_loc2_.groupName == undefined || groupName != _loc2_.groupName)
  280.                {
  281.                   if(!(this._lastx.groupName != undefined && _loc2_.groupName == this._lastx.groupName && this._lastx.selected == true))
  282.                   {
  283.                      this._lastx = _loc2_;
  284.                   }
  285.                }
  286.             }
  287.             else
  288.             {
  289.                this._prevNode = this._lastx;
  290.                this._needPrev = false;
  291.                this._nextIsNext = true;
  292.             }
  293.             if(_loc2_.tabIndex != undefined)
  294.             {
  295.                if(_loc2_.tabIndex == index)
  296.                {
  297.                   if(this._foundList[_loc2_._name] == undefined)
  298.                   {
  299.                      if(this._needPrev)
  300.                      {
  301.                         this._prevObj = _loc2_;
  302.                         this._needPrev = false;
  303.                      }
  304.                      this._nextObj = _loc2_;
  305.                   }
  306.                }
  307.                if(dir && _loc2_.tabIndex > index)
  308.                {
  309.                   if(this._nextObj == undefined || this._nextObj.tabIndex > _loc2_.tabIndex && (_loc2_.groupName == undefined || this._nextObj.groupName == undefined || _loc2_.groupName != this._nextObj.groupName) || this._nextObj.groupName != undefined && this._nextObj.groupName == _loc2_.groupName && this._nextObj.selected != true && (_loc2_.selected == true || this._nextObj.tabIndex > _loc2_.tabIndex))
  310.                   {
  311.                      this._nextObj = _loc2_;
  312.                   }
  313.                }
  314.                else if(!dir && _loc2_.tabIndex < index)
  315.                {
  316.                   if(this._prevObj == undefined || this._prevObj.tabIndex < _loc2_.tabIndex && (_loc2_.groupName == undefined || this._prevObj.groupName == undefined || _loc2_.groupName != this._prevObj.groupName) || this._prevObj.groupName != undefined && this._prevObj.groupName == _loc2_.groupName && this._prevObj.selected != true && (_loc2_.selected == true || this._prevObj.tabIndex < _loc2_.tabIndex))
  317.                   {
  318.                      this._prevObj = _loc2_;
  319.                   }
  320.                }
  321.                if(this._firstObj == undefined || _loc2_.tabIndex < this._firstObj.tabIndex && (_loc2_.groupName == undefined || this._firstObj.groupName == undefined || _loc2_.groupName != this._firstObj.groupName) || this._firstObj.groupName != undefined && this._firstObj.groupName == _loc2_.groupName && this._firstObj.selected != true && (_loc2_.selected == true || _loc2_.tabIndex < this._firstObj.tabIndex))
  322.                {
  323.                   this._firstObj = _loc2_;
  324.                }
  325.                if(this._lastObj == undefined || _loc2_.tabIndex > this._lastObj.tabIndex && (_loc2_.groupName == undefined || this._lastObj.groupName == undefined || _loc2_.groupName != this._lastObj.groupName) || this._lastObj.groupName != undefined && this._lastObj.groupName == _loc2_.groupName && this._lastObj.selected != true && (_loc2_.selected == true || _loc2_.tabIndex > this._lastObj.tabIndex))
  326.                {
  327.                   this._lastObj = _loc2_;
  328.                }
  329.             }
  330.             if(_loc2_.tabChildren)
  331.             {
  332.                this.getTabCandidateFromChildren(_loc2_,index,groupName,dir,_loc5_ && firstChild);
  333.             }
  334.             _loc5_ = false;
  335.          }
  336.          else if(_loc2_._parent == p && _loc2_.tabChildren == true && _loc2_._visible != false)
  337.          {
  338.             if(_loc2_ == this._lastTarget)
  339.             {
  340.                if(_loc2_._searchKey == this._searchKey)
  341.                {
  342.                   continue;
  343.                }
  344.                _loc2_._searchKey = this._searchKey;
  345.                if(this._prevNode == undefined)
  346.                {
  347.                   var _loc3_ = this._lastx;
  348.                   var _loc7_ = false;
  349.                   while(_loc3_ != undefined)
  350.                   {
  351.                      if(_loc3_ == _loc2_)
  352.                      {
  353.                         _loc7_ = true;
  354.                         break;
  355.                      }
  356.                      _loc3_ = _loc3_._parent;
  357.                   }
  358.                   if(_loc7_ == false)
  359.                   {
  360.                      this._prevNode = this._lastx;
  361.                   }
  362.                }
  363.                this._needPrev = false;
  364.                if(this._nextNode == undefined)
  365.                {
  366.                   this._nextIsNext = true;
  367.                }
  368.             }
  369.             else if(!(_loc2_.focusManager != undefined && _loc2_.focusManager._parent == _loc2_))
  370.             {
  371.                if(_loc2_._searchKey == this._searchKey)
  372.                {
  373.                   continue;
  374.                }
  375.                _loc2_._searchKey = this._searchKey;
  376.                this.getTabCandidateFromChildren(_loc2_,index,groupName,dir,_loc5_ && firstChild);
  377.             }
  378.             _loc5_ = false;
  379.          }
  380.       }
  381.       this._lastNode = this._lastx;
  382.       if(lookup)
  383.       {
  384.          if(p._parent != undefined)
  385.          {
  386.             if(p != this._parent)
  387.             {
  388.                if(this._prevNode == undefined && dir)
  389.                {
  390.                   this._needPrev = true;
  391.                }
  392.                else if(this._nextNode == undefined && !dir)
  393.                {
  394.                   this._nextIsNext = false;
  395.                }
  396.                this._lastTarget = this._lastTarget._parent;
  397.                this.getTabCandidate(p._parent,index,groupName,dir,true);
  398.             }
  399.          }
  400.       }
  401.    }
  402.    function getTabCandidate(o, index, groupName, dir, firstChild)
  403.    {
  404.       var _loc2_ = undefined;
  405.       var _loc3_ = true;
  406.       if(o == this._parent)
  407.       {
  408.          _loc2_ = o;
  409.          _loc3_ = false;
  410.       }
  411.       else
  412.       {
  413.          _loc2_ = o._parent;
  414.          if(_loc2_ == undefined)
  415.          {
  416.             _loc2_ = o;
  417.             _loc3_ = false;
  418.          }
  419.       }
  420.       this.walkTree(_loc2_,index,groupName,dir,_loc3_,firstChild);
  421.    }
  422.    function getTabCandidateFromChildren(o, index, groupName, dir, firstChild)
  423.    {
  424.       this.walkTree(o,index,groupName,dir,false,firstChild);
  425.    }
  426.    function getFocusManagerFromObject(o)
  427.    {
  428.       while(o != undefined)
  429.       {
  430.          if(o.focusManager != undefined)
  431.          {
  432.             return o.focusManager;
  433.          }
  434.          o = o._parent;
  435.       }
  436.       return undefined;
  437.    }
  438.    function tabHandler(Void)
  439.    {
  440.       this.bDrawFocus = true;
  441.       var _loc5_ = this.getSelectionFocus();
  442.       var _loc4_ = this.getActualFocus(_loc5_);
  443.       if(_loc4_ != _loc5_)
  444.       {
  445.          _loc5_ = _loc4_;
  446.       }
  447.       if(this.getFocusManagerFromObject(_loc5_) != this)
  448.       {
  449.          _loc5_ == undefined;
  450.       }
  451.       if(_loc5_ == undefined)
  452.       {
  453.          _loc5_ = this.form;
  454.       }
  455.       else if(_loc5_.tabIndex != undefined)
  456.       {
  457.          if(this._foundList != undefined || this._foundList.tabIndex != _loc5_.tabIndex)
  458.          {
  459.             this._foundList = new Object();
  460.             this._foundList.tabIndex = _loc5_.tabIndex;
  461.          }
  462.          this._foundList[_loc5_._name] = _loc5_;
  463.       }
  464.       var _loc3_ = Key.isDown(16) != true;
  465.       this._searchKey = getTimer();
  466.       this._needPrev = true;
  467.       this._nextIsNext = false;
  468.       this._lastx = undefined;
  469.       this._firstNode = undefined;
  470.       this._lastNode = undefined;
  471.       this._nextNode = undefined;
  472.       this._prevNode = undefined;
  473.       this._firstObj = undefined;
  474.       this._lastObj = undefined;
  475.       this._nextObj = undefined;
  476.       this._prevObj = undefined;
  477.       this._lastTarget = _loc5_;
  478.       var _loc6_ = _loc5_;
  479.       this.getTabCandidate(_loc6_,_loc5_.tabIndex != undefined ? _loc5_.tabIndex : 0,_loc5_.groupName,_loc3_,true);
  480.       var _loc2_ = undefined;
  481.       if(_loc3_)
  482.       {
  483.          if(this._nextObj != undefined)
  484.          {
  485.             _loc2_ = this._nextObj;
  486.          }
  487.          else
  488.          {
  489.             _loc2_ = this._firstObj;
  490.          }
  491.       }
  492.       else if(this._prevObj != undefined)
  493.       {
  494.          _loc2_ = this._prevObj;
  495.       }
  496.       else
  497.       {
  498.          _loc2_ = this._lastObj;
  499.       }
  500.       if(_loc2_.tabIndex != _loc5_.tabIndex)
  501.       {
  502.          this._foundList = new Object();
  503.          this._foundList.tabIndex = _loc2_.tabIndex;
  504.          this._foundList[_loc2_._name] = _loc2_;
  505.       }
  506.       else
  507.       {
  508.          if(this._foundList == undefined)
  509.          {
  510.             this._foundList = new Object();
  511.             this._foundList.tabIndex = _loc2_.tabIndex;
  512.          }
  513.          this._foundList[_loc2_._name] = _loc2_;
  514.       }
  515.       if(_loc2_ == undefined)
  516.       {
  517.          if(_loc3_ == false)
  518.          {
  519.             if(this._nextNode != undefined)
  520.             {
  521.                _loc2_ = this._nextNode;
  522.             }
  523.             else
  524.             {
  525.                _loc2_ = this._firstNode;
  526.             }
  527.          }
  528.          else if(this._prevNode == undefined || _loc5_ == this.form)
  529.          {
  530.             _loc2_ = this._lastNode;
  531.          }
  532.          else
  533.          {
  534.             _loc2_ = this._prevNode;
  535.          }
  536.       }
  537.       if(_loc2_ == undefined)
  538.       {
  539.          return undefined;
  540.       }
  541.       this.lastTabFocus = _loc2_;
  542.       this.setFocus(_loc2_);
  543.       if(_loc2_.emphasized != undefined)
  544.       {
  545.          if(this.defPushButton != undefined)
  546.          {
  547.             _loc5_ = this.defPushButton;
  548.             this.defPushButton = _loc2_;
  549.             _loc5_.emphasized = false;
  550.             _loc2_.emphasized = true;
  551.          }
  552.       }
  553.       else if(this.defPushButton != undefined && this.defPushButton != this.__defaultPushButton)
  554.       {
  555.          _loc5_ = this.defPushButton;
  556.          this.defPushButton = this.__defaultPushButton;
  557.          _loc5_.emphasized = false;
  558.          this.__defaultPushButton.__set__emphasized(true);
  559.       }
  560.    }
  561.    function onKeyDown(Void)
  562.    {
  563.       mx.managers.SystemManager.idleFrames = 0;
  564.       if(this.defaultPushButtonEnabled)
  565.       {
  566.          if(Key.getCode() == 13)
  567.          {
  568.             if(this.__get__defaultPushButton() != undefined)
  569.             {
  570.                this.doLater(this,"sendDefaultPushButtonEvent");
  571.             }
  572.          }
  573.       }
  574.    }
  575.    function sendDefaultPushButtonEvent(Void)
  576.    {
  577.       this.defPushButton.dispatchEvent({type:"click"});
  578.    }
  579.    function getMousedComponentFromChildren(x, y, o)
  580.    {
  581.       for(var _loc7_ in o)
  582.       {
  583.          var _loc2_ = o[_loc7_];
  584.          if(_loc2_._visible && _loc2_.enabled && _loc2_._parent == o && _loc2_._searchKey != this._searchKey)
  585.          {
  586.             _loc2_._searchKey = this._searchKey;
  587.             if(_loc2_.hitTest(x,y,true))
  588.             {
  589.                if(_loc2_.onPress != undefined || _loc2_.onRelease != undefined)
  590.                {
  591.                   return _loc2_;
  592.                }
  593.                var _loc3_ = this.getMousedComponentFromChildren(x,y,_loc2_);
  594.                if(_loc3_ != undefined)
  595.                {
  596.                   return _loc3_;
  597.                }
  598.                return _loc2_;
  599.             }
  600.          }
  601.       }
  602.       return undefined;
  603.    }
  604.    function mouseActivate(Void)
  605.    {
  606.       if(!this.bNeedFocus)
  607.       {
  608.          return undefined;
  609.       }
  610.       this._searchKey = getTimer();
  611.       var _loc2_ = this.getMousedComponentFromChildren(this.lastXMouse,this.lastYMouse,this.form);
  612.       if(_loc2_ instanceof mx.core.UIComponent)
  613.       {
  614.          return undefined;
  615.       }
  616.       _loc2_ = this.findFocusFromObject(_loc2_);
  617.       if(_loc2_ == this.lastFocus)
  618.       {
  619.          return undefined;
  620.       }
  621.       if(_loc2_ == undefined)
  622.       {
  623.          this.doLater(this,"restoreFocus");
  624.          return undefined;
  625.       }
  626.       var _loc3_ = _loc2_.hscroll;
  627.       if(_loc3_ != undefined)
  628.       {
  629.          var _loc6_ = _loc2_.scroll;
  630.          var _loc5_ = _loc2_.background;
  631.       }
  632.       this.setFocus(_loc2_);
  633.       var _loc4_ = Selection;
  634.       Selection.setSelection(_loc4_.lastBeginIndex,_loc4_.lastEndIndex);
  635.       if(_loc3_ != undefined)
  636.       {
  637.          _loc2_.scroll = _loc6_;
  638.          _loc2_.hscroll = _loc3_;
  639.          _loc2_.background = _loc5_;
  640.       }
  641.    }
  642.    function _onMouseDown(Void)
  643.    {
  644.       this.bDrawFocus = false;
  645.       if(this.lastFocus != undefined)
  646.       {
  647.          this.lastFocus.drawFocus(false);
  648.       }
  649.       mx.managers.SystemManager.idleFrames = 0;
  650.       var _loc3_ = Selection;
  651.       _loc3_.lastBeginIndex = Selection.getBeginIndex();
  652.       _loc3_.lastEndIndex = Selection.getEndIndex();
  653.       this.lastXMouse = _root._xmouse;
  654.       this.lastYMouse = _root._ymouse;
  655.    }
  656.    function onMouseUp(Void)
  657.    {
  658.       if(this._visible)
  659.       {
  660.          this.doLater(this,"mouseActivate");
  661.       }
  662.    }
  663.    function handleEvent(e)
  664.    {
  665.       if(e.type == "reveal")
  666.       {
  667.          mx.managers.SystemManager.activate(this.form);
  668.       }
  669.       else
  670.       {
  671.          mx.managers.SystemManager.deactivate(this.form);
  672.       }
  673.    }
  674.    static function enableFocusManagement()
  675.    {
  676.       if(!mx.managers.FocusManager.initialized)
  677.       {
  678.          mx.managers.FocusManager.initialized = true;
  679.          Object.registerClass("FocusManager",mx.managers.FocusManager);
  680.          if(_root.focusManager == undefined)
  681.          {
  682.             _root.createClassObject(mx.managers.FocusManager,"focusManager",mx.managers.DepthManager.highestDepth--);
  683.          }
  684.       }
  685.    }
  686. }
  687.